package com.jiyiren.bms.net;

import com.jiyiren.bms.MyConfig;

/**
 * Created by yiji on 2016/11/15.
 */

public class PostBatteryInfo {
    public PostBatteryInfo(String id,String type,String capacity,String remain,
                           String voltage,String temperature,String longitude,
                           String latitude,String health,
                           final SuccessPostBatteryCallback successPostBatteryCallback,
                           final FailPostBatteryCallback failPostBatteryCallback){
        new NetConnection(MyConfig.URL_POST_BATTERYINFO, HttpMethod.POST, new NetConnection.SuccessCallback() {
            @Override
            public void onSuccess(String result) {
                successPostBatteryCallback.onSuccess(result);
            }
        }, new NetConnection.FailCallback() {
            @Override
            public void onFail() {
                failPostBatteryCallback.onFail();
            }
        },MyConfig.KEY_ID,id,MyConfig.KEY_TYPE,type,MyConfig.KEY_CAPACITY,capacity,
                MyConfig.KEY_REMAIN,remain,MyConfig.KEY_VOLTAGE,voltage,MyConfig.KEY_TEMPERATURE,temperature,
                MyConfig.KEY_LONGITUDE,longitude,MyConfig.KEY_LATITUDE,latitude,MyConfig.KEY_HEALTH,health);

    }

    public static interface SuccessPostBatteryCallback{
        void onSuccess(String result);
    }

    public static interface FailPostBatteryCallback{
        void onFail();
    }
}
